-- API Input
 insert into  [dcLINK42PD].[dbo].[dsicfgAPIInputs] 
SELECT [FunctionName]
      ,[EnvironmentID]
      ,[ParameterName]
      ,[ItemDescription]
      ,[Information]
      ,[StartPosition]
      ,[Length]
      ,[Required]
      ,[WhenModified]
      ,[UserModified]
  FROM [YCHOITest].[dbo].[dsicfgAPIInputs]
where [EnvironmentID]='PRD910'


--API Output
select COUNT(*)  from [dcLINK42PD].[dbo].[dsicfgAPIOutputs] 
SELECT [FunctionName]
      ,[EnvironmentID]
      ,[ReturnSetNumber]
      ,[ParameterName]
      ,[ItemDescription]
      ,[StartPosition]
      ,[Length]
      ,[WhenModified]
      ,[UserModified]
  FROM [dcLINK42PD].[dbo].[dsicfgAPIOutputs]


  insert into  [dcLINK42PD].[dbo].[dsicfgAPIOutputs] 
  select [FunctionName]
      ,[EnvironmentID]
      ,[ReturnSetNumber]
      ,[ParameterName]
      ,[ItemDescription]
      ,[StartPosition]
      ,[Length]
      ,[WhenModified]
      ,[UserModified]
	    FROM [YCHOITest].[dbo].[dsicfgAPIOutputs] where [EnvironmentID]='PRD910'


Select COUNT(*) from [dcLINK42PD].[dbo].[dsicfgAPIOutputs]  where [EnvironmentID]='PRD910'
Select COUNT(*) from [dcLINK42PD].[dbo].[dsicfgAPIOutputs]  where [EnvironmentID]='PD811' -- 8.11



 insert into  [dcLINK42PD].[dbo].[dsicfgAPIInputs] 
SELECT [FunctionName]
      ,[EnvironmentID]
      ,[ParameterName]
      ,[ItemDescription]
      ,[Information]
      ,[StartPosition]
      ,[Length]
      ,[Required]
      ,[WhenModified]
      ,[UserModified]
  FROM [YCHOITest].[dbo].[dsicfgAPIInputs]
where [EnvironmentID]='PRD910'

select COUNT(*)  from [dcLINK42PD].[dbo].[dsicfgAPIOutputs]  where [EnvironmentID]='PRD910'


--[dsicfgFieldDescriptions]
Insert into  [dcLINK42PD].[dbo].[dsicfgFieldDescriptions]
SELECT [TableName]
      ,[EnvironmentID]
      ,[FieldName]
      ,[ItemDescription]
      ,[DatabaseLength]
      ,[DatabaseDecimals]
      ,[ScriptLength]
      ,[FieldType]
      ,[Justify]
      ,[PartofKey]
      ,[WhenModified]
      ,[UserModified]
  FROM [YCHOITest].[dbo].[dsicfgFieldDescriptions]
  where
  [EnvironmentID]='PRD910'
GO



--[dsicfgRegisteredAPIs]
insert into [dcLINK42PD].[dbo].[dsicfgRegisteredAPIs]

SELECT [FunctionName]
      ,[EnvironmentID]
      ,[ApplicationName]
      ,[ItemDescription]
      ,[ReturnSetCount]
      ,[Information1]
      ,[Information2]
      ,[WhenModified]
      ,[UserModified]
  FROM [YCHOITest].[dbo].[dsicfgRegisteredAPIs]
  where [EnvironmentID]='PRD910'
GO


Insert into [dcLINK42PD].[dbo].[dsicfgRegisteredTables]
SELECT [TableName]
      ,[EnvironmentID]
      ,[DatabaseName]
      ,[TableType]
      ,[StatusField]
      ,[DeviceField]
      ,[CallIDField]
      ,[DatabaseOwner]
      ,[ConnectionString]
      ,[AutoNumbered]
      ,[DatabaseOwner2]
      ,[ConnectionString2]
      ,[HostMonitoring]
      ,[WhenModified]
      ,[UserModified]
  FROM [YCHOITest].[dbo].[dsicfgRegisteredTables]
  where [EnvironmentID]='PRD910'
GO

USE [YCHOITest]
GO
INSERT INTO [dcLINK42PD].[dbo].[dsie1Parameters]
SELECT [FunctionName]
      ,[EnvironmentID]
      ,[ParameterName]
      ,[StartPosition]
      ,[Length]
      ,[ParameterType]
      ,[WhenModified]
      ,[UserModified]
  FROM [YCHOITest].[dbo].[dsie1Parameters]
  where [EnvironmentID]='PRD910'
GO



 --update [dcLINK42PD].[dbo].[dsicfgConfiguration] set ConfigValue='7C8F698880B19CD37A33AC'   where EnvironmentID='PRD910' and ConfigItem='E1PASSWORD'
 --update   [dcLINK42PD].[dbo].[dsicfgRegisteredTables] set DatabaseOwner='PRODCTL' where EnvironmentID='PRD910' and DatabaseOwner='TESTCTL'
 --update   [dcLINK42PD].[dbo].[dsicfgRegisteredTables] set DatabaseOwner='PRODDTA' where EnvironmentID='PRD910' and DatabaseOwner='TESTDTA'

 select * FROM [dcLINK42PD].[dbo].[dsicfgRegisteredTables] 
 where EnvironmentID='PRD910' and DatabaseOwner='TESTCTL'